//
// itertool - a polynormial and type-safe iterator framework in C++.
//
// Copyright (c) 2021-2025 Feng Cong
//
// Distributed under the MIT Software License
// See accompanying file LICENSE.txt or copy at
// https://opensource.org/licenses/MIT

#pragma once

#include <itertool/itertool_fwd.h>

namespace itertool {
namespace detail {

template <typename T>
class EmptyIterable : public Iterable<T> {
  static_assert(std::is_default_constructible<T>::value,
                "Empty requires T to be default constructible");

 public:
  using ItemType = T;
  ItemType GetNow() override { return {}; }
  bool HasNext() override { return false; }
  void Advance() override {}
  bool IsFinite() override { return true; }
  bool IsResetable() override { return true; }
  EmptyIterable() = default;
};

}  // namespace detail

template <typename T>
Iterator<T> Empty() {
  return MakeIterator<detail::EmptyIterable<T>>();
}

}  // namespace itertool
